﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GcmpModelInterface.h"

namespace gcmp
{

    class IModelView;
    class IGraphicsElementShape;

    /// \brief 轮廓线消隐操作的接口
    ///
    /// 
    class GCMP_MODEL_INTERFACE_EXPORT IHideEdgesOperation
    {
    protected:
        virtual ~IHideEdgesOperation() {}

    public:
        /// \brief   注册轮廓线消隐操作的实例
        ///
        /// \param pOperation   实例的指针
        /// \return
        static void Register(IHideEdgesOperation* pOperation);

        /// \brief   注销轮廓线消隐操作的实例
        ///
        /// \param pOperation   实例的指针
        /// \return
        static void Unregister(IHideEdgesOperation* pOperation);

        /// \brief   获得所有轮廓线消隐操作的实例
        ///
        /// \return  所有的实例
        static const std::vector<IHideEdgesOperation*>& GetAll();

        /// \brief   轮廓线消隐操作的执行函数 - 用于文档打开时候的消隐
        ///
        /// \param pModelView   pModelView的指针
        /// \param visibleGraphicsElementShapes  参与消隐的显示实体
        /// \return  true 成功; false，失败
        virtual bool HideEdges(IModelView* pModelView, const std::vector<const IGraphicsElementShape*>& visibleGraphicsElementShapes) = 0;

        /// \brief   轮廓线消隐操作的执行函数 - 用于创建对象视图更新的消隐
        ///
        /// \param pModelView   pModelView的指针
        /// \param createdVisibleGraphicsElementShapes  新创建的参与消隐的显示实体
        /// \param changedVisibleGraphicsElementShapes  被改动的参与消隐的显示实体
        /// \param elementsChangedByHideEdge  通过消隐而被改动的显示实体
        /// \return  true 成功; false，失败
        virtual bool HideEdges(IModelView* pModelView, const std::vector<const IGraphicsElementShape*>& createdVisibleGraphicsElementShapes, const std::vector<const IGraphicsElementShape*>& changedVisibleGraphicsElementShapes, std::set<ElementId>& elementsChangedByHideEdge) = 0;
    
    };
}

#define REGISTER_HIDEEDGES_OPERATION_IMPLEMENTATION(HIDEEDGES_OPERATION_IMPL_NAME) \
    namespace \
    { \
        void Register##HIDEEDGES_OPERATION_IMPL_NAME() \
        { \
           static HIDEEDGES_OPERATION_IMPL_NAME s_impl; \
           HIDEEDGES_OPERATION_IMPL_NAME::Register(&s_impl); \
        } \
        ONE_TIME_INITIALIZER(Register##HIDEEDGES_OPERATION_IMPL_NAME); \
    } 


